from django.db import models

class ClassModel(models.Model):

    objects = models.Manager()

    class Meta:
        abstract = True
        pass

    def __str__(self):
        if hasattr(self, 'name'):
            return self.name
        return self.pk

    pass

class TableModel(ClassModel):
    char_field = models.CharField(max_length=128,)
    date_field = models.DateField(default='2000-01-01')
    integer_field = models.IntegerField()

    class Meta:
        db_table = 'table_name'
        verbose_name = '数据库表'
        verbose_name_plural = verbose_name
        pass

    pass